package com.springboot.jktj.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.springboot.common.annotation.Log;
import com.springboot.common.core.controller.BaseController;
import com.springboot.common.core.domain.AjaxResult;
import com.springboot.common.enums.BusinessType;
import com.springboot.jktj.domain.JktjCheck;
import com.springboot.jktj.service.IJktjCheckService;
import com.springboot.common.utils.poi.ExcelUtil;
import com.springboot.common.core.page.TableDataInfo;

/**
 * 检查项管理Controller
 * 
 * @author springboot
 * @date 2023-11-26
 */
@RestController
@RequestMapping("/jktj/check")
public class JktjCheckController extends BaseController
{
    @Autowired
    private IJktjCheckService jktjCheckService;

    /**
     * 查询检查项管理列表
     */
    @PreAuthorize("@ss.hasPermi('jktj:check:list')")
    @GetMapping("/list")
    public TableDataInfo list(JktjCheck jktjCheck)
    {
        startPage();
        List<JktjCheck> list = jktjCheckService.selectJktjCheckList(jktjCheck);
        return getDataTable(list);
    }

    /**
     * 导出检查项管理列表
     */
    @PreAuthorize("@ss.hasPermi('jktj:check:export')")
    @Log(title = "检查项管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JktjCheck jktjCheck)
    {
        List<JktjCheck> list = jktjCheckService.selectJktjCheckList(jktjCheck);
        ExcelUtil<JktjCheck> util = new ExcelUtil<JktjCheck>(JktjCheck.class);
        util.exportExcel(response, list, "检查项管理数据");
    }

    /**
     * 获取检查项管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('jktj:check:query')")
    @GetMapping(value = "/{proId}")
    public AjaxResult getInfo(@PathVariable("proId") Long proId)
    {
        return success(jktjCheckService.selectJktjCheckByProId(proId));
    }

    /**
     * 新增检查项管理
     */
    @PreAuthorize("@ss.hasPermi('jktj:check:add')")
    @Log(title = "检查项管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JktjCheck jktjCheck)
    {
        return toAjax(jktjCheckService.insertJktjCheck(jktjCheck));
    }

    /**
     * 修改检查项管理
     */
    @PreAuthorize("@ss.hasPermi('jktj:check:edit')")
    @Log(title = "检查项管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JktjCheck jktjCheck)
    {
        return toAjax(jktjCheckService.updateJktjCheck(jktjCheck));
    }

    /**
     * 删除检查项管理
     */
    @PreAuthorize("@ss.hasPermi('jktj:check:remove')")
    @Log(title = "检查项管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{proIds}")
    public AjaxResult remove(@PathVariable Long[] proIds)
    {
        return toAjax(jktjCheckService.deleteJktjCheckByProIds(proIds));
    }
}
